

public class Utilities {

	public static String randomString(int wordSize) {

		char[] charVect = new char[wordSize];

		for (int i = 0; i < charVect.length; i++) {
			
			String sampleVowel = "aeiou";
			boolean isVowel = sampleVowel.contains("" + charVect[i]);
			
			if (i == 0) {

				charVect[i] = randLetter(LetterType.ALL_LETTERS);

			} else if (isVowel) {

				charVect[i] = i % 2 != 0 ? randLetter(LetterType.CONSONANT) : randLetter(LetterType.VOWEL);

			}

			else {

				charVect[i] = i % 2 != 0 ? randLetter(LetterType.VOWEL) : randLetter(LetterType.CONSONANT);

			}
		}
		charVect[0] = Character.toUpperCase(charVect[0]);
		String randString = new String(charVect);
		// System.out.println(randString);
		return randString;

	}

	public static enum LetterType {
		VOWEL, CONSONANT, ALL_LETTERS
	}

	public static char randLetter(LetterType letterType) {

		final String letterSample = "aeioubcdfghjklmnpqrstvxyz";
		int start, end;

		switch (letterType) {
		case VOWEL:
			start = 0;
			end = 4;
			break;
		case CONSONANT:
			start = 5;
			end = 24;
			break;
		default:// case ALL_LETTERS
			start = 0;
			end = 24;
			break;
		}
		return letterSample.charAt(randNumber(start, end));
	}

	public static int randNumber(int start, int end) {
		int band = end - start;
		return (int) (Math.random() * band + start);

	}

}
